package com.heima.article.listener;

import com.heima.article.service.HotArticleService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 定时任务计算热点文章
 */
@Component
@Slf4j
public class HotArticleSchedule {

    @Autowired
    private HotArticleService hotArticleService;

    @XxlJob("HotArticleJobHandle")
    public void hotArticleScore(){
        log.error("热点文章计算开始了.......");
        hotArticleService.computeHotArticle();
        log.error("热点文章计算结束了.......");
    }
}
